class MyThread extends Thread {
    public MyThread(String name) {
        super(name);
    }

    public MyThread() {
    }

    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {
            System.out.println(this.getName() + ":" + i);
        }
    }
}

public class Text {
    public static void main(String[] args) {
        //实例化对象  创建线程
        MyThread t1 = new MyThread();
        MyThread t2 = new MyThread("线程t2");
        t1.start();
        t2.start();  //启动线程

        for (int i = 0; i < 5; i++) {
            System.out.println("hello main");
        }
    }
}
